home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9773 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.8 KB  |  111 lines

  1. Path: harbinger.cc.monash.edu.au!wombat-1
  2. From: aglow1@mugc.cc.monash.edu.au (Andrew Lowe)
  3. Newsgroups: comp.lang.c++
  4. Subject: Implementing A New Project
  5. Date: Mon, 04 Mar 96 13:50:07 GMT
  6. Organization: Monash University
  7. Message-ID: <4herul$mqf@harbinger.cc.monash.edu.au>
  8. NNTP-Posting-Host: mugca.cc.monash.edu.au
  9. X-NNTP-Posting-User: aglow1
  10. X-Newsreader: News Xpress 2.0 Beta #0
  11. Keyword: C++  Engineering
  12.  
  13.         Having been programming in C for 10 years and the last two in C++ I am 
  14. still only using C++ as a slightly glorified C. I am attempting to get out of 
  15. this mind set but need some advice on a project I am about to start.
  16.  
  17.         The project in question is whats called a structural analysis package. 
  18. Programs of this type are used by structural engineers in the analysis and 
  19. design of structures ranging in size and complexity from domestic dwellings to 
  20. oil rigs and 100 storey buildings. The way the program works is that there are 
  21. points in space called nodes. Nodes usually have an number and a set of 
  22. coordinates. These are not physical, they serve to indicate a start or end 
  23. point. In turn members, such as beams and columns, are defined as running 
  24. between points. Members have properties such as cross sectional area, moments 
  25. of inertia and the like. They are also made of a material such as steel. The 
  26. members also have loads applied to them.
  27.  
  28.         The question is how do I use C++ to its best advantage to develop this 
  29. system. In my current mindset of using C++ as a glorified C I have worked out 
  30. the following class setup:
  31.  
  32. class building {
  33.         class   *nodeList;
  34.         class   *memberList;
  35.         class   *sectPropList;
  36.         class   *materialList;
  37.         .......
  38.         .......
  39.         .......
  40.         };
  41.  
  42. class _nodeList {
  43.         int     nodeNumber;
  44.         float   X;      // 3D coords
  45.         float   Y;
  46.         float   Z;
  47.         ......
  48.         ......
  49.         ......
  50.         };
  51.  
  52. //
  53. // The props for, say, a steel beam
  54. //
  55. class _sectProps {
  56.         int     sectNo;
  57.         float   area;           
  58.         float   Ix;
  59.         float   Iy;
  60.         .....
  61.         .....
  62.         .....
  63.         };
  64.  
  65. //
  66. // A loading class
  67. //
  68. class _membLoad {
  69.         float   position;
  70.         float   magnitude
  71.         int     direction;
  72.         .....
  73.         .....
  74.         .....
  75.         _membLoad *nextMembLoad;
  76.         };
  77.  
  78. class _memberList {
  79.         int     nodeStart;          //contains start node
  80.         int     nodeEnd;          //contains end node
  81.         int     sectNo;            // The sect props for the member
  82.         _membLoad *firstLoad; // Loading on member - linked list
  83.         .....
  84.         .....
  85.         .....
  86.         };
  87.  
  88.         I hope this makes sense. What I am trying to do is show that the 
  89. building is the main object. This object is in turn made up of component parts 
  90. such as the nodes and members. The members are defined as running between the 
  91. nodes and the loads are defined in relation to the members.......sort of thing 
  92. if you get my drift!!!!!!
  93.  
  94.         Inthe considered opinion of the news group readers is there a better 
  95. way, a more C++ way of doing this?
  96.  
  97.         I await your replies.
  98.  
  99.         Regards,
  100.                 Andrew Lowe
  101.         
  102.  
  103. //***************************************************************************\\
  104. || Andrew Lowe B.Eng(Civil)       *|*    Christ himself, on the cross, told  ||
  105. || aglow1@mugc.cc.monash.edu.au   *|*    the guy who banged in the nails     ||
  106. || Structural Engineer &          *|*    "Mate things they can't be all that ||
  107. || Computer Science student       *|*    bad when Derryn Hinch goes to gaol".||
  108. || Monash University (Gippland)   *|*                           - TISM       ||
  109. || Australia                      *|*                                        ||
  110. \\***************************************************************************//
  111.